home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_329 / diskspeed / diskspeedwindow.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  20KB  |  729 lines

  1. /*
  2.  *                          DiskSpeed v3.0
  3.  *                                by
  4.  *                           Michael Sinz
  5.  *
  6.  *             Copyright (c) 1989 by MKSoft Development
  7.  *
  8.  *            MKSoft Development
  9.  *            163 Appledore Drive
  10.  *            Downingtown, PA 19335
  11.  *
  12.  * Yes, this is yet another disk speed testing program, but with a few
  13.  * differences.  It was designed to give the most accurate results of the
  14.  * true disk performance in the system.  For this reason many of
  15.  * DiskSpeed's results may look either lower or higher than current disk
  16.  * performance tests.
  17.  *
  18.  * This program was thrown together in a few hours because I needed more
  19.  * accurate and consistent results for disk performance as seen from the
  20.  * application's standpoint.  This program has now served its purpose and
  21.  * I am now giving it to the rest of the Amiga world to play with as long
  22.  * as all of the files remain together in unmodified form.  (That is, the
  23.  * files DiskSpeed, DiskSpeed.info, DiskSpeed.c, DiskSpeedWindow.c,
  24.  * DiskSpeedWindow.h, MakeBoxes.c, MakeBoxes.h, StandardGadgets.c,
  25.  * StandardGadgets.h, RenderInfo.c, RenderInfo.h, DiskSpeed.doc, and
  26.  * MakeFile)
  27.  *
  28.  * Version 2.0 of this program added a few features and cleaned up the
  29.  * user interface.  I hope you like this...
  30.  *
  31.  * Version 3.0 of this program added the performance stress and cleaned up
  32.  * some parts of the older code.  (Fix to RenderInfo.c)
  33.  *
  34.  ******************************************************************************
  35.  *                                          *
  36.  *    Reading legal mush can turn your brain into guacamole!              *
  37.  *                                          *
  38.  *        So here is some of that legal mush:                  *
  39.  *                                          *
  40.  * Permission is hereby granted to distribute this program's source          *
  41.  * executable, and documentation for non-commercial purposes, so long as the  *
  42.  * copyright notices are not removed from the sources, executable or          *
  43.  * documentation.  This program may not be distributed for a profit without   *
  44.  * the express written consent of the author Michael Sinz.              *
  45.  *                                          *
  46.  * This program is not in the public domain.                      *
  47.  *                                          *
  48.  * Fred Fish is expressly granted permission to distribute this program's     *
  49.  * source and executable as part of the "Fred Fish freely redistributable     *
  50.  * Amiga software library."                              *
  51.  *                                          *
  52.  * Permission is expressly granted for this program and it's source to be     *
  53.  * distributed as part of the Amicus Amiga software disks, and the          *
  54.  * First Amiga User Group's Hot Mix disks.                      *
  55.  *                                          *
  56.  ******************************************************************************
  57.  *
  58.  * This is the window opening and definition code...
  59.  */
  60.  
  61. #include    <exec/types.h>
  62. #include    <exec/memory.h>
  63. #include    <devices/timer.h>
  64. #include    <intuition/intuition.h>
  65. #include    <graphics/gfxmacros.h>
  66. #include    <graphics/copper.h>
  67. #include    <hardware/custom.h>
  68.  
  69. #include    <proto/all.h>
  70.  
  71. #include    <string.h>
  72.  
  73. #include    "RenderInfo.h"
  74. #include    "StandardGadgets.h"
  75. #include    "MakeBoxes.h"
  76. #include    "DiskSpeedWindow.h"
  77.  
  78. extern    struct    Custom    __far    custom;
  79.  
  80. #define    WINDOWTEXT_SIZE    60
  81.  
  82. static char DiskSpeedTitle[14]="DiskSpeed 3.1";
  83. static char WindowText[WINDOWTEXT_SIZE]="DiskSpeed 3.1 - Copyright (c) 1989,90 by MKSoft Development";
  84. static char CPUstressTask[26]="DiskSpeed CPU Stress Task";
  85. static char Dashes[10]="---------";
  86.  
  87. static char fontnam[11]="topaz.font";
  88. static struct TextAttr TOPAZ80={fontnam,TOPAZ_EIGHTY,0,0};
  89.  
  90. #define    TEXT_BUFFER_SIZE    1000L
  91.  
  92. #define    NUM_COP_INS    12000
  93.  
  94. #define    WINDOW_WIDTH    531
  95. #define    WINDOW_HEIGHT    177
  96.  
  97. #define    REQ_X_SIZE    518
  98. #define    REQ_Y_SIZE    152
  99.  
  100. #define    BOX_OUT    0
  101. #define    BOX_IN    1
  102.  
  103. struct BoxType
  104. {
  105.     SHORT    x1,y1;
  106.     SHORT    x2,y2;
  107.     SHORT    type;
  108. };
  109.  
  110. struct Text_Info
  111. {
  112.     SHORT    x,y;
  113.     char    *text;
  114. };
  115.  
  116. struct Gadget_Info
  117. {
  118.     SHORT    x,y;
  119.     SHORT    size;
  120.     SHORT    flags;
  121.     USHORT    ID;
  122.     char    *text;
  123. };
  124.  
  125. struct Result_Info
  126. {
  127.     SHORT    x,y;
  128. };
  129.  
  130. static    struct BoxType BoxTypes[NUM_BOXES]=
  131. {
  132.     {0,0,        WINDOW_WIDTH-1,WINDOW_HEIGHT-1,    BOX_OUT},
  133.     {70,20,        249,31,                BOX_IN},
  134.     {70,37,        524,48,                BOX_IN},
  135.     {16,55,        516,102,            BOX_IN},
  136.     {16,106,    265,154,            BOX_IN},
  137.     {274,106,    373,154,            BOX_IN},
  138.     {143,68,    226,98,                BOX_IN},
  139.     {236,68,    319,98,                BOX_IN},
  140.     {329,68,    412,98,                BOX_IN},
  141.     {422,68,    505,98,                BOX_IN},
  142.     {171,110,    254,150,            BOX_IN},
  143.     {282,127,    365,137,            BOX_IN}
  144. };
  145.  
  146. static    struct Text_Info TextInfo[NUM_TEXT]=
  147. {
  148.     {8,22,        "Device:"},
  149.     {8,39,        "Comment"},
  150.     {265,22,    "Test Intensity:"},
  151.     {24,59,        "Buffer Size"},
  152.     {24,70,        "Bytes/s Create"},
  153.     {24,80,        "Bytes/s Write"},
  154.     {24,90,        "Bytes/s Read"},
  155.     {197,59,    "512"},
  156.     {282,59,    "4096"},
  157.     {367,59,    "32768"},
  158.     {452,59,    "262144"},
  159.     {24,112,    "Files/s Create"},
  160.     {24,122,    "Files/s Open/Close"},
  161.     {24,132,    "Files/s Scan"},
  162.     {24,142,    "Files/s Delete"},
  163.     {288,118,    "Seek/Read"},
  164.     {8,162,        "Performance Stress:"},
  165.     {185,162,    "DMA Contention"},
  166.     {368,162,    "CPU Contention"}
  167. };
  168.  
  169. static    struct Gadget_Info GadgetInfo[NUM_GADGETS]=
  170. {
  171.     {387,19,    41,    GADGIMMEDIATE|TOGGLESELECT,    GADGET_HIGH,    "High"},
  172.     {435,19,    41,    GADGIMMEDIATE|TOGGLESELECT,    GADGET_MED,    "Med"},
  173.     {483,19,    41,    GADGIMMEDIATE|TOGGLESELECT,    GADGET_LOW,    "Low"},
  174.  
  175.     {391,107,    116,    RELVERIFY,    GADGET_START,    "Start Test"},
  176.     {391,124,    116,    RELVERIFY,    GADGET_SAVE,    "Save Results"},
  177.     {391,141,    116,    RELVERIFY,    GADGET_PRINT,    "Print Results"},
  178.  
  179.     {300,159,    41,    TOGGLESELECT,    GADGET_DMA,    "DMA"},
  180.     {483,159,    41,    TOGGLESELECT,    GADGET_CPU,    "CPU"}
  181. };
  182.  
  183. static    struct Result_Info ResultInfo[NUM_RESULTS]=
  184. {
  185.     {149,70},    {149,80},    {149,90},
  186.     {242,70},    {242,80},    {242,90},
  187.     {335,70},    {335,80},    {335,90},
  188.     {428,70},    {428,80},    {428,90},
  189.  
  190.     {177,112},    {177,122},    {177,132},    {177,142},
  191.  
  192.     {288,129}
  193. };
  194.  
  195. /*
  196.  * This define is for the Write_Results routine...
  197.  */
  198. #define    MYCAT(z,y,x)    for (y=x;*y;*z++=*y++)
  199. #define    MYCATNEWLINE(x)    *x++='\n'
  200. #define    MYCATTAB(x)    *x++='\t'
  201. #define    MYCATSPACE(x)    *x++=' '
  202.  
  203. /*
  204.  * This routine builds a string of the results and then writes it to
  205.  * the file passed...
  206.  */
  207. VOID Write_Results(struct MyWindow *MyWindow,BPTR TheFile)
  208. {
  209. register    char    *t;
  210. register    char    *h;
  211. register    char    *Buffer;
  212. register struct    Gadget    *gad;
  213. register    short    flag=FALSE;
  214.  
  215.     if (t=Buffer=AllocMem(TEXT_BUFFER_SIZE,MEMF_PUBLIC|MEMF_CLEAR))
  216.     {
  217.  
  218. /* Title and device name */
  219.         MYCATNEWLINE(t);
  220.         MYCAT(t,h,WindowText);
  221.         MYCATNEWLINE(t);
  222.         MYCATNEWLINE(t);
  223.         MYCAT(t,h,TextInfo[0].text);
  224.         MYCATTAB(t);
  225.         MYCAT(t,h,MyWindow->DeviceName);
  226.         MYCATNEWLINE(t);
  227.         MYCATNEWLINE(t);
  228.         if (MyWindow->Comment[0])
  229.         {
  230.             MYCAT(t,h,TextInfo[1].text);
  231.             MYCATTAB(t);
  232.             MYCAT(t,h,MyWindow->Comment);
  233.             MYCATNEWLINE(t);
  234.             MYCATNEWLINE(t);
  235.         }
  236.  
  237. /* Tell of the test intensity... */
  238.         MYCAT(t,h,TextInfo[2].text);
  239.         MYCATSPACE(t);
  240.         switch(MyWindow->TestFlag)
  241.         {
  242.         case GADGET_HIGH:    MYCAT(t,h,GadgetInfo[0].text);
  243.                     break;
  244.         case GADGET_MED:    MYCAT(t,h,GadgetInfo[1].text);
  245.                     MYCATSPACE(t);
  246.                     break;
  247.         case GADGET_LOW:    MYCAT(t,h,GadgetInfo[2].text);
  248.                     MYCATSPACE(t);
  249.                     break;
  250.         }
  251.  
  252. /* Show the DMA and CPU settings... */
  253.         MYCATSPACE(t);
  254.         MYCATSPACE(t);
  255.         MYCAT(t,h,TextInfo[16].text);
  256.  
  257.         gad=MyWindow->Window->FirstGadget;
  258.         while (gad)
  259.         {
  260.             if (gad->Flags & SELECTED)
  261.             {
  262.                 if (GADGET_DMA==gad->GadgetID)
  263.                 {
  264.                     MYCATSPACE(t);
  265.                     if (flag)
  266.                     {
  267.                         *t++='&';
  268.                         MYCATSPACE(t);
  269.                     }
  270.                     MYCAT(t,h,TextInfo[17].text);
  271.                     flag=TRUE;
  272.                 }
  273.                 else if (GADGET_CPU==gad->GadgetID)
  274.                 {
  275.                     MYCATSPACE(t);
  276.                     if (flag)
  277.                     {
  278.                         *t++='&';
  279.                         MYCATSPACE(t);
  280.                     }
  281.                     MYCAT(t,h,TextInfo[18].text);
  282.                     flag=TRUE;
  283.                 }
  284.             }
  285.             gad=gad->NextGadget;
  286.         }
  287.         if (!flag) MYCAT(t,h," None");
  288.         MYCATNEWLINE(t);
  289.         MYCATNEWLINE(t);
  290.  
  291. /* File Create */
  292.         MYCAT(t,h,MyWindow->MyResults[RESULTS_CREATE].text);
  293.         MYCATSPACE(t);
  294.         MYCAT(t,h,TextInfo[11].text);
  295.         MYCATNEWLINE(t);
  296.  
  297. /* File Open/Close */
  298.         MYCAT(t,h,MyWindow->MyResults[RESULTS_OPEN_CLOSE].text);
  299.         MYCATSPACE(t);
  300.         MYCAT(t,h,TextInfo[12].text);
  301.         MYCATNEWLINE(t);
  302.  
  303. /* File Scan */
  304.         MYCAT(t,h,MyWindow->MyResults[RESULTS_DIR_SCAN].text);
  305.         MYCATSPACE(t);
  306.         MYCAT(t,h,TextInfo[13].text);
  307.         MYCATNEWLINE(t);
  308.  
  309. /* File Delete */
  310.         MYCAT(t,h,MyWindow->MyResults[RESULTS_DELETE].text);
  311.         MYCATSPACE(t);
  312.         MYCAT(t,h,TextInfo[14].text);
  313.         MYCATNEWLINE(t);
  314.  
  315.         MYCATNEWLINE(t);
  316.  
  317. /* Seek and Read */
  318.         MYCAT(t,h,MyWindow->MyResults[RESULTS_SEEK_READ].text);
  319.         MYCATSPACE(t);
  320.         MYCAT(t,h,TextInfo[15].text);
  321.         MYCATNEWLINE(t);
  322.  
  323.         MYCATNEWLINE(t);
  324.  
  325. /* Titles... */
  326.         MYCAT(t,h,TextInfo[3].text);
  327.         MYCATTAB(t);
  328.         MYCAT(t,h,TextInfo[7].text);
  329.         MYCATTAB(t);
  330.         MYCATTAB(t);
  331.         MYCAT(t,h,TextInfo[8].text);
  332.         MYCATTAB(t);
  333.         MYCATTAB(t);
  334.         MYCAT(t,h,TextInfo[9].text);
  335.         MYCATTAB(t);
  336.         MYCATTAB(t);
  337.         MYCAT(t,h,TextInfo[10].text);
  338.         MYCATNEWLINE(t);
  339. /* Dash it all...  :-) */
  340.         MYCAT(t,h,Dashes);
  341.         MYCATTAB(t);
  342.         MYCAT(t,h,Dashes);
  343.         MYCATTAB(t);
  344.         MYCAT(t,h,Dashes);
  345.         MYCATTAB(t);
  346.         MYCAT(t,h,Dashes);
  347.         MYCATTAB(t);
  348.         MYCAT(t,h,Dashes);
  349.         MYCATNEWLINE(t);
  350.  
  351. /* Create Speed */
  352.         MYCAT(t,h,TextInfo[4].text);
  353.         MYCATTAB(t);
  354.         MYCAT(t,h,MyWindow->MyResults[RESULTS_512_CREATE].text);
  355.         MYCATTAB(t);
  356.         MYCAT(t,h,MyWindow->MyResults[RESULTS_4096_CREATE].text);
  357.         MYCATTAB(t);
  358.         MYCAT(t,h,MyWindow->MyResults[RESULTS_32768_CREATE].text);
  359.         MYCATTAB(t);
  360.         MYCAT(t,h,MyWindow->MyResults[RESULTS_262144_CREATE].text);
  361.         MYCATNEWLINE(t);
  362.  
  363. /* Write Speed */
  364.         MYCAT(t,h,TextInfo[5].text);
  365.         MYCATTAB(t);
  366.         MYCAT(t,h,MyWindow->MyResults[RESULTS_512_WRITE].text);
  367.         MYCATTAB(t);
  368.         MYCAT(t,h,MyWindow->MyResults[RESULTS_4096_WRITE].text);
  369.         MYCATTAB(t);
  370.         MYCAT(t,h,MyWindow->MyResults[RESULTS_32768_WRITE].text);
  371.         MYCATTAB(t);
  372.         MYCAT(t,h,MyWindow->MyResults[RESULTS_262144_WRITE].text);
  373.         MYCATNEWLINE(t);
  374.  
  375. /* Read Speed */
  376.         MYCAT(t,h,TextInfo[6].text);
  377.         MYCATTAB(t);
  378.         MYCAT(t,h,MyWindow->MyResults[RESULTS_512_READ].text);
  379.         MYCATTAB(t);
  380.         MYCAT(t,h,MyWindow->MyResults[RESULTS_4096_READ].text);
  381.         MYCATTAB(t);
  382.         MYCAT(t,h,MyWindow->MyResults[RESULTS_32768_READ].text);
  383.         MYCATTAB(t);
  384.         MYCAT(t,h,MyWindow->MyResults[RESULTS_262144_READ].text);
  385.         MYCATNEWLINE(t);
  386.  
  387.         MYCATNEWLINE(t);
  388.         MYCATNEWLINE(t);
  389.  
  390. /* Now, all we have to do is write the sucker... */
  391.         Write(TheFile,Buffer,t-Buffer);
  392.  
  393.         FreeMem(Buffer,TEXT_BUFFER_SIZE);
  394.     }
  395. }
  396.  
  397. VOID __saveds CPU_Stress_Code(VOID)
  398. {
  399. char    test1[WINDOWTEXT_SIZE];
  400. char    test2[WINDOWTEXT_SIZE];
  401.  
  402.     for(;;)
  403.     {
  404.         strcpy(test1,WindowText);
  405.         strcpy(test2,test1);
  406.     }
  407. }
  408.  
  409. VOID CreateCopper(struct MyWindow *MyWin)
  410. {
  411. register        SHORT        loop;
  412. register        SHORT        colour;
  413. register    struct    ViewPort    *vp;
  414. register    struct    UCopList    *ucop;
  415. register        ULONG        mask;
  416.  
  417.     vp=ViewPortAddress(MyWin->Window);
  418.     colour=GetRGB4(vp->ColorMap,0);
  419.  
  420.     if (ucop=AllocMem(sizeof(struct UCopList),MEMF_PUBLIC|MEMF_CLEAR))
  421.     {
  422.         MyWin->DMAstress=ucop;
  423.         CINIT(ucop,NUM_COP_INS+2);
  424.         CWAIT(ucop,12,0);
  425.         mask=0x04044004;
  426.         for (loop=0;loop<NUM_COP_INS;loop++)
  427.         {
  428.             colour^=(0xFFF & mask);
  429.             mask=(mask << 4) | (mask >> 28);
  430.             CMOVE(ucop,custom.color[0],colour);
  431.         }
  432.         CEND(ucop);
  433.         Forbid();
  434.         vp->UCopIns=ucop;
  435.         Permit();
  436.         RethinkDisplay();
  437.     }
  438. }
  439.  
  440. VOID Stress_On(struct MyWindow *MyWin)
  441. {
  442. register    struct    Gadget    *gad;
  443.  
  444.     gad=MyWin->Window->FirstGadget;
  445.     while (gad)
  446.     {
  447.         if (gad->Flags & SELECTED)
  448.         {
  449.             if (GADGET_DMA==gad->GadgetID)
  450.             {
  451.                 CreateCopper(MyWin);
  452.             }
  453.             else if (GADGET_CPU==gad->GadgetID)
  454.             {
  455.                 MyWin->CPUstress=CreateTask(CPUstressTask,0L,CPU_Stress_Code,1000L);
  456.             }
  457.         }
  458.         gad=gad->NextGadget;
  459.     }
  460. }
  461.  
  462. VOID Stress_Off(struct MyWindow *MyWin)
  463. {
  464.     if (MyWin->CPUstress)
  465.     {
  466.         Forbid();    /* This is a work-around for a bug in EXEC... */
  467.         RemTask(MyWin->CPUstress);    /* RemTask in 1.3 and earlier */
  468.         Permit();    /* has a problem of reusing memory after free */
  469.         MyWin->CPUstress=NULL;
  470.     }
  471.     if (MyWin->DMAstress)
  472.     {
  473.         FreeVPortCopLists(ViewPortAddress(MyWin->Window));
  474.         RemakeDisplay();
  475.         MyWin->DMAstress=NULL;
  476.     }
  477. }
  478.  
  479. VOID CloseMyWindow(struct MyWindow *MyWin)
  480. {
  481.     if (MyWin)
  482.     {
  483.         if (MyWin->Window)
  484.         {
  485.             if (MyWin->DragGadget) RemDragGadget(MyWin->DragGadget);
  486.             if (MyWin->FrontBackGadget) RemFrontBackGadget(MyWin->FrontBackGadget);
  487.             if (MyWin->CloseGadget) RemCloseGadget(MyWin->CloseGadget);
  488.             CloseWindow(MyWin->Window);
  489.         }
  490.         FreeMem(MyWin,sizeof(struct MyWindow));
  491.     }
  492. }
  493.  
  494. struct MyWindow *OpenMyWindow(struct RenderInfo *ri)
  495. {
  496. register        SHORT        loop;
  497. register    struct    MyWindow    *MyWin;
  498. register    struct    Border        *MyBorder;
  499. register    struct    IntuiText    *itext;
  500. register    struct    Gadget        *gad;
  501.         struct    NewWindow    nw;
  502.  
  503.     if (MyWin=AllocMem(sizeof(struct MyWindow),MEMF_PUBLIC|MEMF_CLEAR))
  504.     {
  505.  
  506. /* First, set up the requester structures... */
  507.         MyWin->Req.LeftEdge=7;
  508.         MyWin->Req.TopEdge=19;
  509.         MyWin->Req.Width=REQ_X_SIZE;
  510.         MyWin->Req.Height=REQ_Y_SIZE;
  511.         MyWin->Req.BackFill=ri->BackPen;
  512.         MyWin->Req.ReqGadget=&(MyWin->ReqGadget);
  513.  
  514.         MyWin->ReqGadget.Width=REQ_X_SIZE;
  515.         MyWin->ReqGadget.Height=REQ_Y_SIZE;
  516.         MyWin->ReqGadget.Flags=GADGHIMAGE;
  517.         MyWin->ReqGadget.Activation=RELVERIFY;
  518.         MyWin->ReqGadget.GadgetType=BOOLGADGET|REQGADGET;
  519.         MyWin->ReqGadget.GadgetRender=(APTR)&(MyWin->ReqBorders[0]);
  520.         MyWin->ReqGadget.SelectRender=(APTR)&(MyWin->ReqBorders[2]);
  521.         MyWin->ReqGadget.GadgetText=&(MyWin->ReqIText);
  522.         MyWin->ReqGadget.GadgetID=GADGET_REQ;
  523.  
  524.         MyWin->ReqBorders[0].NextBorder=&(MyWin->ReqBorders[1]);
  525.         MyWin->ReqBorders[2].NextBorder=&(MyWin->ReqBorders[3]);
  526.         MyWin->ReqBorders[0].XY=MyWin->ReqBorders[2].XY=MyWin->ReqVector1;
  527.         MyWin->ReqBorders[1].XY=MyWin->ReqBorders[3].XY=MyWin->ReqVector2;
  528.         for (loop=0;loop<4;loop++)
  529.         {
  530.             MyWin->ReqBorders[loop].Count=8;
  531.             MyWin->ReqBorders[loop].DrawMode=JAM1;
  532.         }
  533.         MyWin->ReqBorders[0].FrontPen=MyWin->ReqBorders[3].FrontPen=ri->Highlight;
  534.         MyWin->ReqBorders[1].FrontPen=MyWin->ReqBorders[2].FrontPen=ri->Shadow;
  535.         FillTopLeftDouble_Border(&(MyWin->ReqBorders[0]),REQ_X_SIZE,REQ_Y_SIZE);
  536.         FillBottomRightDouble_Border(&(MyWin->ReqBorders[1]),REQ_X_SIZE,REQ_Y_SIZE);
  537.  
  538.         MyWin->ReqIText.FrontPen=ri->TextPen;
  539.         MyWin->ReqIText.DrawMode=JAM1;
  540.         MyWin->ReqIText.TopEdge=(REQ_Y_SIZE>>1)-8;
  541.         MyWin->ReqIText.ITextFont=&TOPAZ80;
  542.  
  543. /* Now for the window gadgets... */
  544.         gad=&(MyWin->Detail);
  545.         gad->Flags=GADGHNONE;
  546.         gad->GadgetType=BOOLGADGET;
  547.  
  548.         nw.LeftEdge=20;
  549.         nw.TopEdge=11;
  550.         nw.Width=WINDOW_WIDTH;
  551.         nw.Height=WINDOW_HEIGHT;
  552.         nw.DetailPen=-1;
  553.         nw.BlockPen=-1;
  554.         nw.IDCMPFlags=GADGETDOWN|GADGETUP|CLOSEWINDOW|ACTIVEWINDOW;
  555.         nw.Flags=SIMPLE_REFRESH|BORDERLESS|ACTIVATE|NOCAREREFRESH|RMBTRAP;
  556.         nw.FirstGadget=gad;
  557.         nw.CheckMark=NULL;
  558.         nw.Title=NULL;
  559.         nw.Type=WBENCHSCREEN;
  560.  
  561.         MyBorder=NULL;
  562.         for (loop=0;loop<(NUM_BOXES*2);loop++)
  563.         {
  564.             MyWin->Details[loop].Border.NextBorder=MyBorder;
  565.             MyBorder=&(MyWin->Details[loop].Border);
  566.             MyBorder->XY=MyWin->Details[loop].Vectors;
  567.             MyBorder->FrontPen=ri->Highlight;
  568.             MyBorder->DrawMode=JAM1;
  569.             MyBorder->Count=5;
  570.         }
  571.         gad->GadgetRender=(APTR)MyBorder;
  572.  
  573.         for (loop=0;loop<NUM_BOXES;loop++)
  574.         {
  575.             MyWin->Details[loop*2].Border.LeftEdge=BoxTypes[loop].x1;
  576.             MyWin->Details[loop*2].Border.TopEdge=BoxTypes[loop].y1;
  577.             FillTopLeft_Border(&(MyWin->Details[loop*2].Border),
  578.                     BoxTypes[loop].x2-BoxTypes[loop].x1+1,
  579.                     BoxTypes[loop].y2-BoxTypes[loop].y1+1);
  580.             if (BOX_IN==BoxTypes[loop].type) MyWin->Details[loop*2].Border.FrontPen=ri->Shadow;
  581.  
  582.             MyWin->Details[loop*2+1].Border.LeftEdge=BoxTypes[loop].x1;
  583.             MyWin->Details[loop*2+1].Border.TopEdge=BoxTypes[loop].y1;
  584.             FillBottomRight_Border(&(MyWin->Details[loop*2+1].Border),
  585.                     BoxTypes[loop].x2-BoxTypes[loop].x1+1,
  586.                     BoxTypes[loop].y2-BoxTypes[loop].y1+1);
  587.             if (BOX_OUT==BoxTypes[loop].type) MyWin->Details[loop*2+1].Border.FrontPen=ri->Shadow;
  588.         }
  589.  
  590.         itext=NULL;
  591.  
  592.         for (loop=NUM_RESULTS-1;loop>=0;loop--)
  593.         {
  594.             MyWin->MyResults[loop].IntuiText.NextText=itext;
  595.             itext=&(MyWin->MyResults[loop].IntuiText);
  596.             itext->FrontPen=ri->TextPen;
  597.             itext->BackPen=ri->BackPen;
  598.             itext->DrawMode=JAM2;
  599.             itext->LeftEdge=ResultInfo[loop].x;
  600.             itext->TopEdge=ResultInfo[loop].y;
  601.             itext->ITextFont=&TOPAZ80;
  602.             itext->IText=MyWin->MyResults[loop].text;
  603.         }
  604.         for (loop=0;loop<NUM_TEXT;loop++)
  605.         {
  606.             MyWin->TextDetails[loop].NextText=itext;
  607.             itext=&(MyWin->TextDetails[loop]);
  608.             itext->FrontPen=ri->TextPen;
  609.             itext->DrawMode=JAM1;
  610.             itext->LeftEdge=TextInfo[loop].x;
  611.             itext->TopEdge=TextInfo[loop].y;
  612.             itext->ITextFont=&TOPAZ80;
  613.             itext->IText=TextInfo[loop].text;
  614.         }
  615.         gad->GadgetText=itext;
  616.  
  617.         for (loop=0;loop<NUM_GADGETS;loop++)
  618.         {
  619.             gad->NextGadget=&(MyWin->MyGadgets[loop].Gadget);
  620.             gad=gad->NextGadget;
  621.  
  622.             gad->LeftEdge=GadgetInfo[loop].x;
  623.             gad->TopEdge=GadgetInfo[loop].y;
  624.             gad->Width=GadgetInfo[loop].size;
  625.             gad->Height=14;
  626.             gad->Flags=GADGHIMAGE;
  627.             gad->Activation=GadgetInfo[loop].flags;
  628.             gad->GadgetType=BOOLGADGET;
  629.             gad->GadgetRender=(APTR)&(MyWin->MyGadgets[loop].Borders[0]);
  630.             gad->SelectRender=(APTR)&(MyWin->MyGadgets[loop].Borders[2]);
  631.             gad->GadgetText=&(MyWin->MyGadgets[loop].IntuiText);
  632.             gad->GadgetID=GadgetInfo[loop].ID;
  633.             if (GadgetInfo[loop].ID==GADGET_MED)
  634.             {
  635.                 gad->Flags|=SELECTED;
  636.                 MyWin->TestFlag=GadgetInfo[loop].ID;
  637.             }
  638.  
  639.             MyWin->MyGadgets[loop].Borders[0].NextBorder=&(MyWin->MyGadgets[loop].Borders[1]);
  640.             MyWin->MyGadgets[loop].Borders[2].NextBorder=&(MyWin->MyGadgets[loop].Borders[3]);
  641.  
  642.             MyWin->MyGadgets[loop].Borders[0].DrawMode=JAM1;
  643.             MyWin->MyGadgets[loop].Borders[1].DrawMode=JAM1;
  644.             MyWin->MyGadgets[loop].Borders[2].DrawMode=JAM1;
  645.             MyWin->MyGadgets[loop].Borders[3].DrawMode=JAM1;
  646.  
  647.             MyWin->MyGadgets[loop].Borders[0].FrontPen=ri->Highlight;
  648.             MyWin->MyGadgets[loop].Borders[1].FrontPen=ri->Shadow;
  649.             MyWin->MyGadgets[loop].Borders[2].FrontPen=ri->Shadow;
  650.             MyWin->MyGadgets[loop].Borders[3].FrontPen=ri->Highlight;
  651.  
  652.             MyWin->MyGadgets[loop].Borders[0].XY=MyWin->MyGadgets[loop].Vectors1;
  653.             MyWin->MyGadgets[loop].Borders[1].XY=MyWin->MyGadgets[loop].Vectors2;
  654.             MyWin->MyGadgets[loop].Borders[2].XY=MyWin->MyGadgets[loop].Vectors1;
  655.             MyWin->MyGadgets[loop].Borders[3].XY=MyWin->MyGadgets[loop].Vectors2;
  656.  
  657.             MyWin->MyGadgets[loop].Borders[0].Count=8;
  658.             MyWin->MyGadgets[loop].Borders[1].Count=8;
  659.             MyWin->MyGadgets[loop].Borders[2].Count=8;
  660.             MyWin->MyGadgets[loop].Borders[3].Count=8;
  661.  
  662.             FillTopLeftDouble_Border(&(MyWin->MyGadgets[loop].Borders[0]),GadgetInfo[loop].size,14);
  663.             FillBottomRightDouble_Border(&(MyWin->MyGadgets[loop].Borders[1]),GadgetInfo[loop].size,14);
  664.  
  665.             MyWin->MyGadgets[loop].IntuiText.TopEdge=3;
  666.             MyWin->MyGadgets[loop].IntuiText.FrontPen=ri->TextPen;
  667.             MyWin->MyGadgets[loop].IntuiText.DrawMode=JAM1;
  668.             MyWin->MyGadgets[loop].IntuiText.ITextFont=&TOPAZ80;
  669.             MyWin->MyGadgets[loop].IntuiText.IText=GadgetInfo[loop].text;
  670.             MyWin->MyGadgets[loop].IntuiText.LeftEdge=
  671.                 (GadgetInfo[loop].size-IntuiTextLength(&(MyWin->MyGadgets[loop].IntuiText))) >> 1;
  672.         }
  673.  
  674.         gad->NextGadget=&(MyWin->DeviceGadget);
  675.         gad=gad->NextGadget;
  676.         gad->LeftEdge=72;
  677.         gad->TopEdge=22;
  678.         gad->Width=176;
  679.         gad->Height=9;
  680.         gad->Activation=RELVERIFY;
  681.         gad->GadgetType=STRGADGET;
  682.         gad->SpecialInfo=(APTR)&(MyWin->DeviceGadgetInfo);
  683.         gad->GadgetID=GADGET_STRING;
  684.         gad->UserData=(APTR)&(MyWin->CommentGadget);
  685.         MyWin->DeviceGadgetInfo.Buffer=MyWin->DeviceName;
  686.         MyWin->DeviceGadgetInfo.MaxChars=32;
  687.  
  688.         gad->NextGadget=&(MyWin->CommentGadget);
  689.         gad=gad->NextGadget;
  690.         gad->LeftEdge=72;
  691.         gad->TopEdge=39;
  692.         gad->Width=451;
  693.         gad->Height=9;
  694.         gad->Activation=RELVERIFY;
  695.         gad->GadgetType=STRGADGET;
  696.         gad->SpecialInfo=(APTR)&(MyWin->CommentGadgetInfo);
  697.         gad->GadgetID=GADGET_STRING;
  698.         gad->UserData=(APTR)&(MyWin->DeviceGadget);
  699.         MyWin->CommentGadgetInfo.Buffer=MyWin->Comment;
  700.         MyWin->CommentGadgetInfo.MaxChars=80;
  701.  
  702.         gad->NextGadget=&(MyWin->Background);
  703.         gad=gad->NextGadget;
  704.         gad->Flags=GADGHNONE|GADGIMAGE;
  705.         gad->GadgetType=BOOLGADGET;
  706.         gad->GadgetRender=(APTR)&(MyWin->Image_Background);
  707.         MyWin->Image_Background.Width=WINDOW_WIDTH;
  708.         MyWin->Image_Background.Height=WINDOW_HEIGHT;
  709.         MyWin->Image_Background.PlaneOnOff=ri->BackPen;
  710.  
  711.         loop=FALSE;
  712.         if (MyWin->Window=OpenWindow(&nw))
  713.          if (MyWin->CloseGadget=AddCloseGadget(MyWin->Window,ri,7,3))
  714.           if (MyWin->FrontBackGadget=AddFrontBackGadget(MyWin->Window,ri,473,3))
  715.            if (MyWin->DragGadget=AddDragGadget(MyWin->Window,ri,DiskSpeedTitle,33,3,438))
  716.            {
  717.             loop=TRUE;
  718.            }
  719.  
  720.         if (!loop)
  721.         {
  722.             CloseMyWindow(MyWin);
  723.             MyWin=NULL;
  724.         }
  725.         else SetWindowTitles(MyWin->Window,(UBYTE *)-1L,WindowText);
  726.     }
  727.     return(MyWin);
  728. }
  729.